package com.example.layui.demo.mapper;

import com.example.layui.demo.entity.Article;
import com.example.layui.demo.entity.Article;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

@Mapper
@Repository
public interface ArticleMapper {

    @Select("select * from t_article limit #{start},#{limit}")
    List<Article> getArticleList(Map<String, Integer> param);

    @Select("select * from t_article where id=#{id}")
    Article getArticleByid(Integer id);

    @Select("select count(*) from t_article")
    Integer getArticleCount();


    @Update("update t_article set title=#{title} ,categories=#{categories},created=#{created},city=#{city},sex=#{sex} where id=#{id}")
    Integer updateArticle1(Article Article);

    @Select("select count(*) from t_article where title=#{title} and categories=#{categories} ")
    Integer getArticleCountWhere(Article Article);


   // @Delete("delete from t_article where id=#{id}")
    Integer DeleteArticleByids(Integer[] id);
}
